﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

using Maticsoft.Common;
using LTP.Accounts.Bus;
using DQYT.HTDZ.BLL;
using DQYT.HTDZ.Model;
namespace DQYT.HTDZ.Web.BDDATATABLE
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(!PageValidate.IsDecimal(txtTABLE_ID.Text))
			{
				strErr+="TABLE_ID格式错误！\\n";	
			}
			if(this.txtTABLE_CODE.Text.Trim().Length==0)
			{
				strErr+="TABLE_CODE不能为空！\\n";	
			}
			if(this.txtTABLE_NAME.Text.Trim().Length==0)
			{
				strErr+="TABLE_NAME不能为空！\\n";	
			}
			if(this.txtDESCTRIPTION.Text.Trim().Length==0)
			{
				strErr+="DESCTRIPTION不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			decimal TABLE_ID=decimal.Parse(this.txtTABLE_ID.Text);
			string TABLE_CODE=this.txtTABLE_CODE.Text;
			string TABLE_NAME=this.txtTABLE_NAME.Text;
			string DESCTRIPTION=this.txtDESCTRIPTION.Text;

			BDDATATABLEModel model=new BDDATATABLEModel();
			model.TABLE_ID=TABLE_ID;
			model.TABLE_CODE=TABLE_CODE;
			model.TABLE_NAME=TABLE_NAME;
			model.DESCTRIPTION=DESCTRIPTION;

			BDDATATABLEBLL bll=new BDDATATABLEBLL();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
